﻿using Dapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIG.DAL.Dapper.Model
{
    /// <summary>
    /// A class which represents the WorkSet table.
    /// </summary>
	[Table("WorkSet")]
    public partial class Work
    {
        [Key]
        public virtual int Id { get; set; }
        public virtual string Title { get; set; }
        public virtual string Body { get; set; }
        public virtual string Abstract { get; set; }
        //public virtual int? FinishYear { get; set; }
        public virtual string Thumbnail { get; set; }
        public virtual string ImageUrl { get; set; }
        //public virtual string Demourl { get; set; }
        public virtual int ViewCount { get; set; }
        public virtual bool Recommend { get; set; }
        public virtual bool Active { get; set; }
        public virtual string CreatedBy { get; set; }
        public virtual DateTime CreatedDate { get; set; }
        public virtual DateTime? UpdatedDate { get; set; }
        public virtual string UpdatedBy { get; set; }
        public virtual string CategoryIds { get; set; }
        //public virtual int SolutionId { get; set; }
        //public virtual int? ClientId { get; set; }
        public virtual IEnumerable<WorkWorkCategory> WorkWorkCategories { get; set; }
        public virtual IEnumerable<WorkCategory> Categories { get; set; }
        [Editable(false)]
        public string CategoryTitle
        {
            get
            {
                if (this.Categories != null)
                {
                    string[] q = (from i in this.Categories
                                  select i.Title).ToArray();
                    return string.Join("、", q);
                }

                return string.Empty;
            }

        }
    }
}
